package com.oig.base.api;


import com.oig.base.api.factory.CurrRateFallBackFactory;
import com.oig.sys.base.dto.CurrRateDto;
import com.oig.sys.base.vo.CurrRateVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.time.YearMonth;
import java.util.List;

@FeignClient(contextId="currRateService",value="sys-base-server",path="/currRate",fallbackFactory=CurrRateFallBackFactory.class)
public interface CurrRateService {

    /**
     * 获取汇率
     * @param currency 币种
     * @param type 0-银行实时汇率，1-海关汇率
     */
    @PostMapping(value = "/getCurrRate")
    CurrRateVo getCurrRate(@RequestParam("currency") String currency, @RequestParam("type") String type);

    /**
     * 添加汇率，定时任务调用
     */
    @PostMapping(value = "/addCurrRate")
    CurrRateVo addCurrRate(@RequestBody CurrRateDto currRateDto) ;


    /**
     * 根据币种和月份获取海关汇率
     * @param currency
     * @param yearMonth
     * @return
     */
    @GetMapping(value = "/listByCustomsCurrAndYearMonth")
    List<CurrRateVo> listByCustomsCurrAndYearMonth(@RequestParam("currency") List<String> currency,
                                                          @RequestParam("yearMonth") YearMonth yearMonth);
}
